var fs = require("fs");
var path = require("path");
var stream = require("stream");

var Readable = stream.Readable;
var rs = new Readable();

var filePath1 = path.join(__dirname,"/from.txt");
var filePath2 = path.join(__dirname,"/to.txt");

var readable = fs.createReadStream(filePath1);
var writeable = fs.createWriteStream(filePath2);

var read = "";
rs._read = function(){
} 
readable.on("data", function(chunk) {
    read = chunk.toString("utf8").toUpperCase();
    rs.push(read); 
})
readable.on("end",function(){
    console.log(read);
})
rs.pipe(writeable);